<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<script type="text/javascript">
	$(document).ready(function() {
		$("#storeForm").validate({
			rules : {
				name : {
					required : true
				},
				tag : {
					required : true
				},
				description : {
					required : true
				},
				address : {
					required : true
				}
			},
			messages : {
				name : {
					required : "请输入名称。"
				},
				tag : {
					required : "请输入关键字。"
				},
				description : {
					required : "请输入产品信息和服务。"
				},
				address : {
					required : "请输入具体地址。"
				}
			}
		});
	});
</script>
<div >
	<c:if test="${not empty store}">
		<form:form commandName="store" id="storeForm" action="member/store/update"
			method="post" class="form-horizontal" enctype="multipart/form-data">

			<form:input path="userId" type="hidden" value="${userId}" />
			<form:input path="type" type="hidden" value="${store.type}" />

			<div class="control-group">
				<c:choose>
					<c:when test="${store.type==2}">
						<form:label class="control-label" for="name" path="name">用户名：</form:label>
						<form:errors path="name" />
					</c:when>
					<c:when test="${store.type==3}">
						<form:label class="control-label" for="name" path="name">商户名：</form:label>
						<form:errors path="name" />
					</c:when>
					<c:otherwise>
						<form:label class="control-label" for="name" path="name">企业名：</form:label>
						<form:errors path="name" />
					</c:otherwise>
				</c:choose>
				<div class="controls">
					<form:input path="name" type="text" value="${store.name}" />
				</div>
			</div>

			<div class="control-group">
				<form:label class="control-label" for="description"
					path="description">产品信息与服务：</form:label>
				<div class="controls">
					<form:textarea for="description" path="description"
						value="${store.description}" cols="25" rows="3" />
					<form:errors path="description" />
				</div>
			</div>

			<div class="control-group">
				<form:label class="control-label" for="tag" path="tag">关键字：</form:label>
				<div class="controls">
					<form:input path="tag" type="text" value="${store.tag}" />
					<form:errors path="tag" />
				</div>
			</div>

			<div class="control-group">
				<c:if test="${store.type==2}">
					<form:label class="control-label" for="jobTitle" path="jobTitle">职位/职称：</form:label>
					<div class="controls">
						<form:input path="jobTitle" type="text" value="${store.jobTitle}" />
					</div>
				</c:if>
			</div>

			<div class="control-group">
					<c:if test="${store.type==3}">
						<form:label class="control-label" for="identifier"
							path="identifier">营业执照：</form:label>
					</c:if>
					<c:if test="${store.type==4}">
						<form:label class="control-label" for="identifier"
							path="identifier">法人代表：</form:label>
					</c:if>
				<div class="controls">
					<form:input path="identifier" type="text" class="input"
						value="${store.identifier}" />
				</div>
			</div>
			<div class="control-group">
				<c:choose>
					<c:when test="${store.type==2}">
						<form:label class="control-label" for="address" path="address">单位地址：</form:label>
					</c:when>
					<c:when test="${store.type==3}">
						<form:label class="control-label" for="address" path="address">商户地址：</form:label>
					</c:when>
					<c:otherwise>
						<form:label class="control-label" for="address" path="address">企业地址：</form:label>
					</c:otherwise>
				</c:choose>

				<div class="controls">
					<form:input path="city" type="text" class="input"
						value="${store.city}" />
					<form:input path="district" type="text" class="input"
						value="${store.district}" />
					<form:input path="address" type="text" class="input"
						value="${store.address}" />
					<form:errors path="address" />
				</div>
			</div>
			
			<div class="control-group">
				<form:label class="control-label" for="showStorePosition"
					path="description">是否公开商店位置：</form:label>
				<div class="controls">
				    <c:choose>
						<c:when test="${store.showStorePosition==1}">
							<form:radiobutton path="showStorePosition" value="1" checked="checked" />是
						&nbsp;&nbsp;&nbsp;&nbsp; 
						<form:radiobutton path="showStorePosition" value="0" />
						否
					</c:when>
						<c:otherwise>
							<form:radiobutton path="showStorePosition" value="1" />是
						&nbsp;&nbsp;&nbsp;&nbsp; 
						<form:radiobutton path="showStorePosition" value="0" checked="checked" />
						否
					</c:otherwise>
					</c:choose>
					<form:errors path="showStorePosition" />
				</div>
			</div>

			<div class="control-group">
				<br> <label for="productSize"> <strong>
						该用户发布的商品与发起的优惠活动:&nbsp; <font color="red">${store.productSize}
					</font>
				</strong>
				</label>

			</div>

			<div class="control-group">
				<div class="controls">
					<button type="submit" class="btn">保存</button>
				</div>
			</div>
		</form:form>
	</c:if>
	<c:if test="${empty store}">
		<div id="main">
			<h3>该用户还不是付费用户，暂时还没有产品和服务信息</h3>
		</div>
	</c:if>
</div>